// 坐标解压与路线绘制
export function cb(ret) {
  const coords = ret.result.routes[0].polyline
  const pl = []
  let kr = 1000000
  for (let i = 2; i < coords.length; i++) {
    coords[i] = Number(coords[i - 2]) + Number(coords[i]) / kr
  }
  for (let n = 0; n < coords.length; n += 2) {
    pl.push(new TMap.LatLng(coords[n], coords[n + 1]))
  }
  display_polyline(pl)
}





// 路线标记绘制
export function display_polyline(pl) {
  new TMap.MultiPolyline({
    id: "polyline-layer",
    map: window.map,
    styles: {
      style_blue: new TMap.PolylineStyle({
        color: "#3777FF",
        width: 8,
        borderWidth: 3,
        borderColor: "#FFF",
        lineCap: "round",
        showArrow: true,
        arrowOptions: {
          width: 6,
          height: 10,
          space: 20
        }
      })
    },
    geometries: [{
      id: "pl_1",
      styleId: "style_blue",
      paths: pl
    }]
  })
}